﻿using System;

namespace PdfSdk.Pdf
{
    public class PdfDictionaryWrapper : ObjectWrapper, IPdfPrimitiveWrapper
    {
        public PdfDictionaryWrapper(object obj) : base(obj)
        {
        }

        public IPdfPrimitiveWrapper this[string key]
        {
            get
            {
                var obj = InvokeMethod("get_Item", new Type[] { typeof(string) }, key);
                return PdfPrimitiveHelper.GetPrimitiveWrapper(obj);
            }
            set
            {
                InvokeMethod("set_Item", new Type[] { typeof(string), PdfTypes.IPdfPrimitive }, key, value?.OriginalObject);
            }
        }

        public void Remove(string key)
        {
            InvokeMethod("Remove", new Type[] { typeof(string) }, key);
        }
    }
}
